<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" id="i1" v-model="num1">
    <input type="text" id="i2" v-model="num2">
    <input type="button" value="加" @click="f('+')">
    <input type="button" value="减" @click="f('-')">
    <input type="button" value="乘" @click="f('*')">
    <input type="button" value="除" @click="f('/')">
    <h1>结果：{{result}}</h1>
</div>


<script src="../js/vue.js"></script>
<script>
    let v = new Vue({
        el:"div",
        data:{
            num1:"",
            num2:"",
            result:""
        },
        methods:{
            f(x){
                v.result = eval(parseInt(v.num1)+x+parseInt(v.num2));
            }
        }
    })
</script>

</body>
</html>